<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>用户中心</title>
	<link rel="stylesheet" type="text/css" href="./css/api.css" />
	<link rel="stylesheet" type="text/css" href="./css/aui.css" />
	<link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css" />
	<link rel="stylesheet" type="text/css" href="./css/style.css" />
	<script type="text/javascript" src="./script/api.js"></script>
	<script type="text/javascript" src="./script/doT.min.js"></script>
	<script type="text/javascript" src="./script/aui-tab.js"></script>
	<link rel="stylesheet" type="text/css" href="./css/aui-slide.css" />
	<script type="text/javascript" src="./script/aui-slide.js"></script>
	<script type="text/javascript" src="./script/base.js"></script>
	<script type="text/javascript" src="./script/jquery-3.2.0.js"></script>
	<script type="text/javascript">
		function closeWin() {
			api.closeWin({});
		};
	</script>
</head>

<body>
<!--     <header class="aui-bar aui-bar-nav" id="topbarRecharge" style="display: none;">
        <a class="aui-pull-left aui-btn" onclick="closeFrame()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">充值</div>
    </header>
    <header class="aui-bar aui-bar-nav" id="topbarWithdraw" style="display: none;">
        <a class="aui-pull-left aui-btn" onclick="closeFrame()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">提现</div>
    </header>
    <header class="aui-bar aui-bar-nav" id="topbarBank" style="display: none;">
        <a class="aui-pull-left aui-btn" onclick="closeFrame()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">开通存款账户</div>
    </header> -->

    <div id="list">
    	<div class="user-t">
    		<div class="aui-row">
    			<div class="aui-col-xs-3 user-t-l"  id='youke'  tapmode onclick="openUserInfo();">
    				<a href=""><img src="image/user-t-l.png"></a>
    			</div>

    			<dl class="aui-col-xs-6 user-t-m" >
    				<dt>您好<span>  游客</span><span></span></dt>
    			</dl>
    			<div id="is_login" class="aui-col-xs-3 user-t-r" tapmode onclick="login();" style="display: none">登录</div>
    		</div>
    		<div id="is_bank">
    			<div class="user-t-d-y">
    				<div class="user-t-d-y-t">
    					资产总额(元)
    					<p>0.00</p>
    				</div>
    				<div class="user-t-d-y-d">
    					<ul>
    						<li>
    							可用余额(元)
    							<p>0.00</p>
    						</li>
    						<li>
    							待收收益(元)
    							<p>0.00</p>
    						</li>
    						<li>
    							已获收益(元)
    							<p>0.00</p>
    						</li>
    					</ul>
    				</div>
    			</div>
    		</div>
    		<div class="user-1">
    			<ul class="aui-row">
    				<li class="aui-col-xs-6" tapmode onclick="sh_bank_recharge()"><span class="fa fa-credit-card-alt"></span>充值</li>
    				<li class="aui-col-xs-6" tapmode onclick="sh_bank_withdraw()"><span class="fa fa-money"></span>提现</li>
    			</ul>
    		</div>
    		<div class="user-t-d" id="no_bank" style="display: none">
    			<div class="user-t-d-t">
    				开通哈尔滨银行存管账户,为您的账户保驾护航
    				<span></span>
    			</div>
    			<div class="user-t-d-m" onclick="openBank();">立即开通</div>
    		</div>
    	</div>
    	<div class="user-2">
    		<ul class="aui-row">
    			<li class="aui-col-xs-3" tapmode onclick="loan_list()">
    				<p class="fa fa-file-text"></p>
    				已投项目
    			</li>
    			<li class="aui-col-xs-3" tapmode onclick="my_repay_plan()">
    				<p class="fa fa-calendar"></p>
    				回款计划
    			</li>
    			<li class="aui-col-xs-3" tapmode onclick="my_fund()">
    				<p class="fa fa-pie-chart"></p>
    				资金统计
    			</li>
    			<li class="aui-col-xs-3" tapmode onclick="zhitou_list()">
    				<p class="fa fa-area-chart"></p>
    				我的随意享
    			</li>
    		</ul>
    	</div>
    	<div class="aui-content aui-margin-b-15">
    		<ul class="aui-list aui-list-in">
<!--                 <li class="aui-list-item">
                    <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="recommend_friends()">
                        <div class="aui-list-item-title">邀请好友</div>
                        <div class="aui-list-item-right"></div>
                    </div>
                </li> -->
                <li class="aui-list-item">
                	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="red_packet_list()">
                		<div class="aui-list-item-title">我的红包</div>
                		<div class="aui-list-item-right">待使用：0</div>
                	</div>
                </li>
                <li class="aui-list-item">
                	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="coupon_list();">
                		<div class="aui-list-item-title">我的加息券</div>
                		<div class="aui-list-item-right">待使用: 0</div>
                	</div>
                </li>
                <li class="aui-list-item">
                	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="money();">
                		<div class="aui-list-item-title">我的体验金</div>
                		<div class="aui-list-item-right">金额: 0</div>
                	</div>
                </li>
                <li class="aui-list-item">
                	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="integral_mall();">
                		<div class="aui-list-item-title">积分商城</div>
                	</div>
                </li>
            </ul>
        </div>
    </div>
</body>
<!-- 登录时调用的模板 -->
<script type="text/template" id="template">
	<div class="user-t">
		<div class="aui-row">
			<div class="aui-col-xs-3 user-t-l" tapmode onclick="openUserInfo();">
				<a href=""><img src="image/user-t-l.png"></a>
			</div>
			{{? it.user_name}}
			<dl class="aui-col-xs-6 user-t-m">
				<dt>您好<span> {{=it.user_name}} </span><span></span></dt>
			</dl>
			{{??}}
			<dl class="aui-col-xs-6 user-t-m">
				<dt>您好<span></span><span></span></dt>
			</dl>
			{{?}}
		</div>
		{{? it.is_hrb == '1'}}
		<div class="user-t-d-y">
			<div class="user-t-d-y-t">
				资产总额(元)
				<p>{{=it.total_money}}</p>
			</div>
			<div class="user-t-d-y-d">
				<ul>
					<li>
						可用余额(元)
						<p>{{=it.money}}</p>
					</li>
					<li>
						待收收益(元)
						<p>{{=it.load_wait_earnings}}</p>
					</li>
					<li>
						已获收益(元)
						<p>{{=it.load_pay_earnings}}</p>
					</li>
				</ul>
			</div>
		</div>
		<div class="user-1">
			<ul class="aui-row">
				<li class="aui-col-xs-6" tapmode onclick="sh_bank_recharge()"><span class="fa fa-credit-card-alt"></span>充值</li>
				<li class="aui-col-xs-6" tapmode onclick="sh_bank_withdraw()"><span class="fa fa-money"></span>提现</li>
			</ul>
		</div>
		{{?? }}
		<div class="user-t-d">
			<div class="user-t-d-t">
				开通哈尔滨银行存管账户,为您的账户保驾护航
				<span></span>
			</div>
			<div class="user-t-d-m" onclick="openBank();">立即开通</div>
		</div>
		{{?}}
	</div>
	<div class="user-2">
		<ul class="aui-row">
			<li class="aui-col-xs-3" tapmode onclick="loan_list()">
				<p class="fa fa-file-text"></p>
				已投项目
			</li>
			<li class="aui-col-xs-3" tapmode onclick="my_repay_plan()">
				<p class="fa fa-calendar"></p>
				回款计划
			</li>
			<li class="aui-col-xs-3" tapmode onclick="my_fund()">
				<p class="fa fa-pie-chart"></p>
				资金统计
			</li>
			<li class="aui-col-xs-3" tapmode onclick="zhitou_list()">
				<p class="fa fa-area-chart"></p>
				我的随意享
			</li>
		</ul>
	</div>
	<div class="aui-content aui-margin-b-15">
		<ul class="aui-list aui-list-in">
<!--             <li class="aui-list-item">
                <div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="recommend_friends()">
                    <div class="aui-list-item-title">邀请好友</div>
                    <div class="aui-list-item-right"></div>
                </div>
            </li> -->
            <li class="aui-list-item">
            	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="red_packet_list()">
            		<div class="aui-list-item-title">我的红包</div>
            		<div class="aui-list-item-right">待使用：{{=it.ecv}}</div>
            	</div>
            </li>
            <li class="aui-list-item">
            	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="coupon_list();">
            		<div class="aui-list-item-title">我的加息券</div>
            		<div class="aui-list-item-right">待使用: {{=it.jxq}}</div>
            	</div>
            </li>
            <li class="aui-list-item">
            	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="money();">
            		<div class="aui-list-item-title">我的体验金</div>
            		{{? it.learn_money}}
            		<div class="aui-list-item-right">金额: {{=it.learn_money}}元</div>
            		{{??}}
            		<div class="aui-list-item-right">金额: 0元</div>
            		{{?}}
            	</div>
            </li>
            <li class="aui-list-item">
            	<div class="aui-list-item-inner aui-list-item-arrow" tapmode onclick="integral_mall();">
            		<div class="aui-list-item-title">积分商城</div>
                    <div class="aui-list-item-right">积分: {{=it.score}}</div>
                </div>
            </li>
        </ul>
    </div>
</script>
<script type="text/javascript">
	apiready = function() {

      //适配iPhonex  上边尺寸

      var deviceModel = api.deviceModel;
      if (deviceModel.indexOf('iPhone10') > -1) {
    // X
    $('#is_login').css({'padding-top':'5px','font-size':'0.8rem'});
    $('#youke').css('padding-top','5px');


} else {

}

var userid = $api.getStorage('userid');
if (userid) {
	$('#is_login').css('display','none');
	updateData();
}else{
	$('#is_login').css('display','block');
	$('#is_login').css('display','block');
	$('#is_bank').css('display','block');
	$('#no_bank').css('display','none');
}
};

    // 打开登录
    function login() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }
        api.openFrame({
        	name: 'login',
        	url: './login.html',
        	rect: {
        		x: 0,
        		y: 0,
        		w: 'auto',
        		h: 'auto'
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });
    }

    // 更新数据,模板函数
    function updateData() {
        // 进度提示框
        api.showProgress({
        	title: '努力加载中...',
        	text: '请稍等...',
        	modal: false
        });
        var userid = $api.getStorage('userid');
        // 如果已登录 获取数据
        if (userid) {
        	api.ajax({
        		url: webAddress + '/index.php?ctl=app_user_center&act=userinfo',
        		method: 'post',
        		data: {
        			values: {
        				id: userid,
        			},
        		}
        	}, function(ret, err) {
                // var ret = $api.jsonToStr(ret);
                // alert(ret);
                if (ret) {
                    // 关闭下拉刷新控件
                    api.refreshHeaderLoadDone();
                    api.hideProgress();
                    if (ret.status == 0) {
                    	alert(ret.info);
                    	return false;
                    } else {
                    	var data = ret.user;

                        // 用户昵称
                        var user_name = ret.user.user_name;
                        $api.setStorage('user_name', user_name);
                        // 用户手机号
                        var mobile = ret.user.mobile;
                        // 用户手机号,密文
                        $api.setStorage('mobileM', mobile);
                        var is_hrb = ret.user.is_hrb;
                        // 大鹏licai-zhitou页面刷新
                        sendMsg();
                        $api.setStorage('is_hrb', is_hrb);
                        // 总资产
                        var total_money = outputmoney(ret.user.total_money);
                        data.total_money = total_money;
                        $api.setStorage('total_money', total_money);
                        // 可用余额
                        var money = outputmoney(ret.user.money);
                        data.money = money;
                        $api.setStorage('money', money);
                        // 冻结资金(待收本金)
                        var lock_money = outputmoney(ret.user.lock_money);
                        data.lock_money = lock_money;
                        // 已获收益
                        var load_pay_earnings = outputmoney(ret.user.load_pay_earnings);
                        data.load_pay_earnings = load_pay_earnings;
                        // 待获收益
                        var load_wait_earnings = outputmoney(ret.user.load_wait_earnings);
                        data.load_wait_earnings = load_wait_earnings;

                        // 红包数量
                        var ecv = ret.user.ecv;
                        $api.setStorage('ecv', ecv);
                        // 加息券数量
                        var jxq = ret.user.jxq;
                        $api.setStorage('jxq', jxq);
                        // 用户积分
                        var score = ret.user.score;
                        $api.setStorage('score', score);

                        // userInfo数据
                        // 调用模板函数
                        templateFun(data);

                        var learn_list = ret.user.learn_list;

                        if (learn_list) {
                        	for (var i = 0; i < learn_list.length; i++) {
                        		var learn_list_id = learn_list[i].id;
                        		var learn_list_money = learn_list[i].money;
                        		api.ajax({
                        			url: webAddress + '/index.php?ctl=app_user_center&act=get_ecv',
                        			method: 'post',
                        			data: {
                        				values: {
                        					id: userid,
                        					ecv_id: learn_list_id,
                        					table: '1',
                        				},
                        			}
                        		},function(ret, err){
                        			if (ret) {
                        				api.openWin({
                        					name: 'tiyanjin-detail',
                        					url: './tiyanjin-detail.html',
                        					pageParam: {
                        						learn_list_money: learn_list_money
                        					}
                        				});
                        			} else {
                        				alert(err.msg);
                        			}
                        		});
                        		return false;
                        	}

                        }

                        var ecv_list = ret.user.ecv_list;
                        // 如果有红包
                        if (ecv_list) {
                        	for (var i = 0; i < ecv_list.length; i++) {
                        		var ecv_type_id = ecv_list[i].ecv_type_id;
                        		var ecv_id = ecv_list[i].id;
                                // alert(ecv_id);
                                api.ajax({
                                	url: webAddress + '/index.php?ctl=app_user_center&act=get_ecv',
                                	method: 'post',
                                	data: {
                                		values: {
                                			id: userid,
                                			ecv_id: ecv_id
                                		},
                                	}
                                },function(ret, err){
                                	if (ret) {
                                        // alert( JSON.stringify( ret ) );
                                        api.openWin({
                                        	name: 'hongbao',
                                        	url: './hongbao.html',
                                        	pageParam: {
                                        		ecv_type_id: ecv_type_id
                                        	}
                                        });
                                    } else {
                                    	alert( JSON.stringify( err ) );
                                    }
                                });
                                return false;
                            }
                        }
                    }
                } else {
                	alert(err.msg);
                    // 关闭下拉刷新控件
                    api.refreshHeaderLoadDone();
                    // 关闭加载状态控件
                    api.hideProgress();
                }
            });
} else {
            // 关闭下拉刷新控件
            api.refreshHeaderLoadDone();
            // 关闭加载状态控件
            api.hideProgress();
            templateFun();
        }
    };

    // 模板赋值函数
    function templateFun(data) {

    	var template = $api.byId('template');
    	var dotFn = doT.template(template.innerHTML);
    	var html = dotFn(data);
    	var user = $api.byId('list');
    	$api.html(user, html);
    }

    // 开通银行
    function openBank() {

    	var userid = $api.getStorage('userid');
    	if (!userid) {
    		alert('请先登录');
    		var delay = 0;
    		if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        // $('#topbarBank').show();
        // $api.fixStatusBar($api.dom('#topbarBank'));
        // var headerPos = $api.offset($api.dom('#topbarBank'));

        api.openFrame({
        	name: 'open-bank',
        	url: './open-bank.html',
        	rect: {
        		x: 0,
        		y: 0,
        		w: 'auto',
        		h: '70px',
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });

        api.openFrame({
        	name: 'bank',
        	url: './bank.html',
        	rect: {
        		x: 0,
        		y: '70px',
        		w: 'auto',
        		h: 'auto'
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });

    }

    // 已投项目
    function loan_list() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'loan_list',
        	url: './loan-list.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    };

    // 回款计划
    function my_repay_plan() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        // api.openWin({
        //     name: 'my_repay_plan',
        //     url: './my-repay-plan.html',
        //     bounces: false,
        //     delay: delay,
        //     slidBackEnabled: true,
        //     vScrollBarEnabled: false,
        //     progress: {
        //         type: "page"
        //     }
        // });

        api.openWin({
        	name: 'toubiao',
        	url: './toubiao.html',
        	pageParam: {
        		name: 'test'
        	}
        });
    };

    // 资金统计
    function my_fund() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'my_fund',
        	url: './my-fund.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    };

    // 我的智投
    function zhitou_list() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'zhitou-list',
        	url: './zhitou-list.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    }

    // 红包列表
    function red_packet_list() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'red_packet_list',
        	url: './red-packet-list.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    };

    // 加息券列表
    function coupon_list() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'coupon_list',
        	url: './coupon-list.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    };

    // 体验金列表
    function money() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'money',
        	url: './money.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    };

    // 充值
    function sh_bank_recharge() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openFrame({
        	name: 'recharge-top',
        	url: './recharge-top.html',
        	rect: {
        		x: 0,
        		y: 0,
        		w: 'auto',
        		h: '70px',
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });

        api.openFrame({
        	name: 'sh_bank_recharge',
        	url: './sh-bank-recharge.html',
        	rect: {
        		x: 0,
        		y: '70px',
        		w: 'auto',
        		h: 'auto'
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });
    };

    // 提现
    function sh_bank_withdraw() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }


        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        // var topbarWithdraw = document.getElementById("topbarWithdraw");
        // topbarWithdraw.style.display='inline-block';
        // $('#topbarWithdraw').show();
        // $api.fixStatusBar($api.dom('#topbarWithdraw'));
        // var headerPos = $api.offset($api.dom('#topbarWithdraw'));

        api.openFrame({
        	name: 'withdraw-top',
        	url: './withdraw-top.html',
        	rect: {
        		x: 0,
        		y: 0,
        		w: 'auto',
        		h: '70px',
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });

        api.openFrame({
        	name: 'sh_bank_withdraw',
        	url: './sh-bank-withdraw.html',
        	rect: {
        		x: 0,
        		y: '70px',
        		w: 'auto',
        		h: 'auto'
        	},
        	pageParam: {
        		name: 'test'
        	},
        	bounces: false,
        	bgColor: 'rgba(0,0,0,0)',
        	vScrollBarEnabled: true,
        	hScrollBarEnabled: true
        });
    };

    // 推荐好友
    function recommend_friends() {
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'recommend_friends',
        	url: './recommend-friends.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });


    };

    //个人信息页面
    function openUserInfo() {

    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }
        var is_hrb = $api.getStorage('is_hrb');

        if (is_hrb && is_hrb!='undefined') {
        	api.openWin({
        		name: 'user-info',
        		url: './user-info.html',
        		bounces: false,
        		delay: delay,
        		slidBackEnabled: true,
        		vScrollBarEnabled: false,
        		progress: {
        			type: "page"
        		}
        	});
        }else{
        	alert('请先开通银行账户!');
        	openBank();
        }
    }

    // 修改密码之后 跳到登录页面
    function closeToLogin(){
    	login();
    }

    function closeBottomFrame(){

    	api.closeFrame({
    		name: 'sh_bank_recharge'
    	});
    	api.closeFrame({
    		name: 'sh_bank_withdraw'
    	});
    	api.closeFrame({
    		name: 'bank'
    	});
    	api.closeFrame({
    		name: 'recharge-top'
    	});
    	api.closeFrame({
    		name: 'withdraw-top'
    	});

    };

    function closeTopFrame(){
    	api.closeFrame({
    		name: 'recharge-top'
    	});
    	api.closeFrame({
    		name: 'withdraw-top'
    	});
    	api.closeFrame({
    		name: 'open-bank'
    	});
    }

    // 积分商城
    function integral_mall(){
    	var delay = 0;
    	if (api.systemType != 'ios') {
            // delay = 300;
        }

        var userid = $api.getStorage('userid');
        if (!userid) {
        	alert('请先登录');
        	var delay = 0;
        	if (api.systemType != 'ios') {
                // delay = 300;
            }
            api.openFrame({
            	name: 'login',
            	url: './login.html',
            	rect: {
            		x: 0,
            		y: 0,
            		w: 'auto',
            		h: 'auto'
            	},
            	pageParam: {
            		name: 'test'
            	},
            	bounces: false,
            	bgColor: 'rgba(0,0,0,0)',
            	vScrollBarEnabled: true,
            	hScrollBarEnabled: true
            });
            return false;
        }

        api.openWin({
        	name: 'integral',
        	url: './integral.html',
        	bounces: false,
        	delay: delay,
        	slidBackEnabled: true,
        	vScrollBarEnabled: false,
        	progress: {
        		type: "page"
        	}
        });
    }

// 登录成功发送刷新请求
function sendMsg() {
	api.sendEvent({
		name: 'login_success',
		extra: {
			key1: 'value1',
			key2: 'value2'
		}
	});
}
</script>

</html>
